<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<script>
    const str = 'Hello world, how are you';
    const firstRepeating = str => {
        const map = new Map();
        for(let i = 0; i < str.length; i++){
            if(map.has(str[i])){
                return map.get(str[i]);
            };
            map.set(str[i], i);
        };
        return -1;
    };
    console.log(firstRepeating(str));const str = 'Hello world, how are you';
    const firstRepeating = str => {
        const map = new Map();
        for(let i = 0; i < str.length; i++){
            if(map.has(str[i])){
                return map.get(str[i]);
            };
            map.set(str[i], i);
        };
        return -1;
    };
    console.log(firstRepeating(str));


    Array.prototype.searchFirstNotRepeat = function () {
        var curArr = this, val;

        while (-1 == (val = curArr.indexOf(curArr.shift())));

        return val;
    };

    conole.log([1, 1, 2, 3, 4, 5, 3].searchFirstNotRepeat());
</script>
</body>
</html>
